refactor: move category types and validation logic to shared package#2888
Merged
dqnykamp merged 5 commits intoDoenet:mainfrom Apr 30, 2026
Merged
refactor: move category types and validation logic to shared package#2888dqnykamp merged 5 commits intoDoenet:mainfrom
dqnykamp merged 5 commits intoDoenet:mainfrom
Conversation
- Move CategoryGroup and Category types to packages/shared/src/types/categories.ts - Move isActivityFullyCategorized() logic to packages/shared/src/logic/browsable.ts - Update all imports across app and api workspaces to use the shared package - Export new types and logic from packages/shared/src/index.ts This allows category-related code to be reused across the platform without duplication. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…actor/browsable-validation
Keep isBrowsable as the public interface, clarify its current behavior, and export the precise category helper for reuse. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors category-related types and “browsable/discoverable” validation into @doenet-tools/shared so both the app and API can reuse the same definitions and logic, reducing duplicated type declarations and helper code.
Changes:
- Added shared
Category/CategoryGrouptypes underpackages/shared. - Added shared
isBrowsable()logic for category-completeness checks. - Updated app and API imports to consume the shared types/logic and removed duplicated local type definitions.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/shared/src/types/categories.ts | Introduces shared Category and CategoryGroup type definitions. |
| packages/shared/src/logic/browsable.ts | Adds shared isBrowsable() logic (currently backed by category completeness). |
| packages/shared/src/index.ts | Re-exports the new shared types and browsable logic from the package entrypoint. |
| apps/app/src/widgets/editor/EditCategories.tsx | Switches category type imports to @doenet-tools/shared. |
| apps/app/src/widgets/editor/EditCategories.cy.tsx | Switches CategoryGroup import to @doenet-tools/shared for tests. |
| apps/app/src/widgets/FilterPanel.tsx | Switches CategoryGroup import to @doenet-tools/shared. |
| apps/app/src/widgets/FilterPanel.cy.tsx | Switches CategoryGroup import to @doenet-tools/shared for tests. |
| apps/app/src/utils/classification.tsx | Removes the locally-defined isActivityFullyCategorized() implementation (now in shared). |
| apps/app/src/types.ts | Removes duplicated category type definitions from app-local types. |
| apps/app/src/popups/ShareMyContentModal.tsx | Uses shared isBrowsable() instead of the removed local categorization helper. |
| apps/app/src/paths/editor/EditorSettingsMode.tsx | Switches category type imports to @doenet-tools/shared. |
| apps/app/src/paths/editor/EditorSettingsMode.cy.tsx | Switches category type imports to @doenet-tools/shared for tests. |
| apps/app/src/paths/editor/EditorHeader.tsx | Uses shared isBrowsable() and switches category types to @doenet-tools/shared. |
| apps/app/src/paths/Explore.tsx | Switches CategoryGroup import to @doenet-tools/shared. |
| apps/app/src/drawers/ExploreFilterDrawer.tsx | Switches CategoryGroup import to @doenet-tools/shared. |
| apps/app/src/drawers/ExploreFilterDrawer.cy.tsx | Switches CategoryGroup import to @doenet-tools/shared for tests. |
| apps/api/src/types.ts | Removes duplicated category type definitions from API-local types. |
| apps/api/src/query/classification.ts | Switches CategoryGroup type usage to come from @doenet-tools/shared. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dqnykamp
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move category-related types and logic to the shared package to reduce duplication and enable reuse across the platform.
Changes
Types moved to
packages/shared/src/types/categories.tsCategoryGroup- represents a group of related categories with constraintsCategory- represents an individual categoryLogic moved to
packages/shared/src/logic/browsable.tsisBrowsable()is the public interface for discoverability checksImports updated across app and api workspaces to use
@doenet-tools/sharedNotes
cqnykamp:refactor/browsable-validation.